package com.idroid.database;

import java.util.ArrayList;

import com.idroid.domain.ParkingArea;

import android.content.Context;
import android.database.SQLException;
import android.os.AsyncTask;

public class UpdateAreaLocationAsyncTask extends AsyncTask<Void, Void, Integer> {

	Context ctx;
	int id;
	double lat;
	double lon;

	public UpdateAreaLocationAsyncTask(Context ctx, int id, double lat,
			double lon) {
		this.ctx = ctx;
		this.id = id;
		this.lat = lat;
		this.lon = lon;
	}

	@Override
	protected Integer doInBackground(Void... params) {

		Integer returnedInt = 0;
		ParkingFlexDataSource source = new ParkingFlexDataSource(ctx);
		try {
			source.open();

			returnedInt = source.updateAreaLatLong(id, lat, lon);

			System.out.println(id + " " + lat + " " + lon);

			source.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			source.close();
			e.printStackTrace();
		}

		return returnedInt;
	}

}
